<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<!--axios-->
<div id="app">
    <todo>
        <todo-title slot="todo-title" :title="title"></todo-title>
        <todo-items slot="todo-items" v-for="(item,index) in items" :item="item" :index="index" v-on:re="removeItems(index)" :key="index"></todo-items>
    </todo>
</div>
<h1>ffdf3</h1>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    Vue.component("todo", {
        template:
            '<div>' +
                '<slot name="todo-title"></slot>' +
                '<ul>' +
                    '<slot name="todo-items"></slot>' +
                '</ul>' +
            '</div>',
    })
    Vue.component("todo-title",{
        props:['title'],
        template:'<div>{{title}}</div>'
    })
    Vue.component("todo-title2",{
        props:['title'],
        template:'<div>{{title}}</div>'
    })
    Vue.component("todo-items",{
        props:['item','index'],
        template:'<li>{{item}}<button @click="remove">删除</button></li>',
        methods:{
            remove :function (index) {
                this.$emit('re',index)
            }
        }
    })
    var vm = new Vue({
        el: "#app",
        data:{
            title:"cai",
            items:["wo","shi","cai"]
        },
        methods:{
            removeItems:function (index){
                this.items.splice(index,1);
            }
        }
    });
</script>
</body>
</html>